package com.tianji.gateway.config;

import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 解决GET请求一次传输知识数组过大问题
 */
@Configuration
public class NettyServerConfig {

    @Bean
    public WebServerFactoryCustomizer<NettyReactiveWebServerFactory> nettyHttpServerCustomizer() {
        return factory -> factory.addServerCustomizers(httpServer ->
            httpServer.httpRequestDecoder(decoder -> decoder
                .maxInitialLineLength(16384)  // 请求行最大长度（默认4096）
                .maxHeaderSize(32768)         // 请求头最大大小（默认8192）
            )
        );
    }
}